<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body><!-- split()、replace()、charAt() -->
     <script  type="text/javascript">
        var str = "how are you i am fine";
        var arr = str.split(" ");
        for (var i = 0; i < arr.length; i++) {
            arr[i] = arr[i].replace(arr[i].charAt(0), arr[i].charAt(0).toUpperCase());
        }
        console.log('初始字符串为；' + str);
        console.log("单词首字母大小写转换后的字符串为："+arr.join(" "));
    </script>
</body>
</html>